<%--
  Created by IntelliJ IDEA.
  User: infinity
  Date: 2021/11/18
  Time: 22:06
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
<html>
<link>
    <title>登录结果</title>
    <script src="js/jquery-1.11.1.js"></script>
    <script src="js/bootstrap.js"></script>
    <link rel="stylesheet" href="css/bootstrap-theme.css"/>
    <link rel="stylesheet" href="css/bootstrap.css"/>
</head>
<body>
<sql:setDataSource var="userDatabase" driver="com.mysql.cj.jdbc.Driver" url="jdbc:mysql://localhost:3306/kkb_05?serverTimeZone=UTC" user="root" password="123456"></sql:setDataSource>
<sql:query var="result" dataSource="${userDatabase}" sql="select password from user where username=?">
    <sql:param value="${param.name}"></sql:param>
</sql:query>
<c:choose>
    <c:when test="${!(empty result)}">
        <c:forEach var="row" items="${result.rows}">
            <c:if test="${row.password == param.password}">
                <h1>欢迎您！${param.name}</h1>
                <form action="invalidate_session.jsp">
                    <button type="submit" class="btn btn-default">退出</button>
                </form>
            </c:if>
        </c:forEach>
    </c:when>
    <c:otherwise>
        <h1>登录失败${param.name}${param.password}</h1>
    </c:otherwise>
</c:choose>
</body>
</html>
